const koa = require("koa")
const app = new koa()
const path = require("path")
const bodyParser = require("koa-bodyparser")
app.use(bodyParser())

var koa_jwt = require('koa-jwt');
let privateKey = "hello koa"
//验证
app.use(koa_jwt({ secret: privateKey }).unless({ path: [/^\/login/, /^\/news/] }));


const render = require('koa-art-template');
render(app, {
  root: path.join(__dirname, 'view'),
  extname: '.art',
});


const userRouter = require("./router/user")
const cateRouter = require("./router/cate")
const newsRouter = require("./router/news")
app.use(userRouter.routes())

app.use(cateRouter.routes())

app.use(newsRouter.routes())





app.listen(3000,()=>{
    console.log('3000 running')
})